#include <iostream>

using namespace std;
typedef unsigned long long BIG;


int main()
{
	BIG X = 1000000;
	int n[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};

	for(int i=1; i<X; i++)
		next_permutation (n,n+10);

	for(int i=0; i<10; i++)
		cout << n[i];

	return 0;
}
